#include "GameObject.h"

GameObject::GameObject()
{
}

GameObject::~GameObject()
{
	std::list<GameAbility*>::iterator it;

	for(it = abilities.begin(); it != abilities.end(); ++it)
	{
		delete (*it);
	}

	abilities.clear();
}

void GameObject::AddAbility(GameAbility* ability)
{
	abilities.push_back( ability->Clone() );
}

void GameObject::Activate(GameAbility* ability)
{
	std::list<GameAbility*>::iterator it;

	for(it = abilities.begin(); it != abilities.end(); ++it)
	{
		GameAbility *currentAbility = (*it);

		if (currentAbility->Activate(ability))
		{
			break;
		}
	}
}